Skip to content

feat(calm-widgets): extend render-interfaces to support related mode#2701

Merged
rocketstack-matt merged 6 commits into
finos:mainfrom
markscott-ms:feat/1600-ignore-connected-interfaces
Jun 21, 2026
Merged

feat(calm-widgets): extend render-interfaces to support related mode#2701
rocketstack-matt merged 6 commits into
finos:mainfrom
markscott-ms:feat/1600-ignore-connected-interfaces

Conversation

@markscott-ms

@markscott-ms markscott-ms commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Description

Closes #1600

Extends the render-interfaces option on the block-architecture widget to a three-value enum: false | true | 'related'.

When using focus-interfaces with edges=connected and render-interfaces=true, the widget currently renders all interfaces on every visible node — including unrelated ones on connected nodes. This makes the diagram cluttered and harder to read when the user is trying to understand a specific interface and its connections.

With render-interfaces=related, only the interfaces that actually participate in the active relationships are rendered. All other interfaces (on seed nodes and connected nodes alike) are hidden. Edges still route to the interface sub-nodes, which are now correctly rendered.

Option values

Value Behaviour
false (default) Interfaces are not rendered
true All interfaces rendered as small boxes connected by dotted lines
related Only interfaces that appear in the active (filtered) relationships are rendered

Example (payment architecture)

Focusing on payment-api with edges=connected render-interfaces=true:

Interface render-interfaces=true render-interfaces=related
payment-api (seed) ✅ shown ✅ shown
fraud-check-api (active destination) ✅ shown ✅ shown
email-iface (active destination) ✅ shown ✅ shown
audit-log-iface (seed, not in any active rel) ✅ shown ❌ hidden
risk-model-iface, score-db-iface (connected, inactive) ✅ shown ❌ hidden
sms-iface (connected, inactive) ✅ shown ❌ hidden

Screenshots

render-interfaces=true (existing behaviour)

{{block-architecture focus-interfaces="payment-api" render-interfaces=true edges="connected"}}
image

render-interfaces=related (new behaviour)

{{block-architecture focus-interfaces="payment-api" render-interfaces="related" edges="connected"}}
image

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🎨 Code style/formatting changes
  • ♻️ Refactoring (no functional changes)
  • ⚡ Performance improvements
  • ✅ Test additions or updates
  • 🔧 Chore (maintenance, dependencies, CI, etc.)

Affected Components

  • CLI (cli/)
  • Schema (calm/)
  • CALM AI (calm-ai/)
  • CALM Hub (calm-hub/)
  • CALM Hub UI (calm-hub-ui/)
  • CALM Server (calm-server/)
  • CALM Widgets (calm-widgets/)
  • Documentation (docs/)
  • Shared (shared/)
  • VS Code Extension (calm-plugins/vscode/)
  • Dependencies
  • CI/CD

Commit Message Format ✅

feat(calm-widgets): extend render-interfaces to support related mode

Testing

  • I have tested my changes locally
  • I have added/updated unit tests
  • All existing tests pass

New tests added:

  • node-factory.spec.ts: filters interfaces by activeInterfaceIds; produces no interfaces when set is empty
  • container-builder.spec.ts: passes activeInterfaceIds through to the node factory
  • options-parser.spec.ts: parses render-interfaces=related
  • E2E fixture render-interfaces-related/: side-by-side before/after using a 3-node payment architecture

Checklist

  • My commits follow the conventional commit format
  • I have updated documentation if necessary
  • I have added tests for my changes (if applicable)
  • My changes follow the project's coding standards

@markscott-ms markscott-ms requested a review from a team as a code owner June 20, 2026 19:59
…rchitecture widget

When focus-interfaces is used with edges=connected, all interfaces on all
visible nodes are rendered, including unrelated ones on connected nodes.
The new ignore-connected-interfaces option restricts rendering to only
the interfaces that appear in the active (filtered) relationships, hiding
all others regardless of which node they belong to.

Closes finos#1600
@markscott-ms markscott-ms force-pushed the feat/1600-ignore-connected-interfaces branch from 1b8d5a8 to 4815c7f Compare June 20, 2026 20:06
@markscott-ms markscott-ms requested a review from Copilot June 20, 2026 20:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new ignore-connected-interfaces option to the block-architecture widget (calm-widgets) to declutter focused interface views by rendering only interfaces that participate in the currently active/filtered relationships.

Changes:

  • Introduces the ignore-connected-interfaces option (types + parsing) and threads an activeInterfaceIds allowlist into VM construction.
  • Updates node/container VM factories to optionally filter rendered interfaces, with unit coverage for the new filtering behavior.
  • Adds an end-to-end fixture demonstrating before/after output and documents the new option in calm-widgets/README.md.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
calm-widgets/test-fixtures/block-architecture-widget/ignore-connected-interfaces/template.hbs New fixture template showing before/after usage of the option.
calm-widgets/test-fixtures/block-architecture-widget/ignore-connected-interfaces/expected.md Expected Mermaid output for the new fixture (before/after).
calm-widgets/test-fixtures/block-architecture-widget/ignore-connected-interfaces/context.json Fixture model containing interfaces + relationships to exercise filtering.
calm-widgets/src/widgets/block-architecture/types.ts Adds the new option to public and normalized options types.
calm-widgets/src/widgets/block-architecture/core/vm-builder.ts Computes and passes “active interfaces” allowlist into container/node building.
calm-widgets/src/widgets/block-architecture/core/visibility-resolver.ts Extends VisibilityResult to expose seedNodes from strategies.
calm-widgets/src/widgets/block-architecture/core/options-parser.ts Parses ignore-connected-interfaces into normalized options.
calm-widgets/src/widgets/block-architecture/core/options-parser.spec.ts Unit tests for parsing the new option.
calm-widgets/src/widgets/block-architecture/core/factories/vm-factory-interfaces.ts Extends VMNodeFactory.createLeafNode signature to accept activeInterfaceIds.
calm-widgets/src/widgets/block-architecture/core/factories/node-factory.ts Filters rendered interfaces using the passed allowlist.
calm-widgets/src/widgets/block-architecture/core/factories/node-factory.spec.ts Unit tests for interface filtering behavior (including empty allowlist).
calm-widgets/src/widgets/block-architecture/core/builders/container-builder.ts Threads activeInterfaceIds through to the node factory.
calm-widgets/src/widgets/block-architecture/core/builders/container-builder.spec.ts Verifies activeInterfaceIds are passed to the node factory.
calm-widgets/src/widgets.e2e.spec.ts Adds an E2E test that runs the new fixture.
calm-widgets/README.md Documents the new widget option and links the new fixture example.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread calm-widgets/src/widgets/block-architecture/core/vm-builder.ts

@rocketstack-matt rocketstack-matt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean implementation that addresses #1600. The new collectActiveInterfaceIds matches the widget's established toKindView(...).kind === 'connects' idiom, and the unit tests plus the before/after e2e fixture genuinely exercise the behaviour (7 interfaces -> 3 active).

Two points inline: one dead seedNodes field worth removing before merge, and a non-blocking naming question.

For the record, Copilot's global-uniqueness concern is incorrect - idsAreUnique (shared spectral rule) enforces interface-id uniqueness across the whole architecture, so the Set<string> allowlist is safe; you already replied to that effect.

Comment thread calm-widgets/src/widgets/block-architecture/core/visibility-resolver.ts Outdated
Comment thread calm-widgets/README.md Outdated
| `render-node-type-shapes` | boolean | `false` | If `true`, render nodes with different Mermaid shapes based on their `node-type`. Supports built-in CALM types: `actor`, `database`, `webclient`, `service`, `system`, `messagebus`. |
| `node-type-map` | stringified JSON map | — | Custom mapping of node types to built-in shapes, e.g. `{"cache": "database", "queue": "messagebus"}`. Only used when `render-node-type-shapes` is `true`. |
| `render-interfaces` | boolean | `false` | If `true`, render each node’s `interfaces` as small interface boxes connected by dotted lines. |
| `ignore-connected-interfaces` | boolean | `false` | Only meaningful when `render-interfaces=true`. If `true`, only render interfaces that appear in the active (filtered) relationships — hiding all others. Useful with `focus-interfaces` + `edges=connected` to declutter connected nodes while keeping the relevant interface endpoints visible. |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name vs behaviour is slightly off: ignore-connected-interfaces also drops inactive interfaces on the focused/seed node - e.g. audit-log-iface on payment-service in the fixture - not just connected nodes. The description here is accurate ("hiding all others"), but the option name implies only connected-node interfaces are affected. Consider a clearer name (only-active-interfaces / ignore-inactive-interfaces) or a one-line note that seed-node interfaces are filtered too. (non-blocking)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It bugged me too. I'll decide on an alternative.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decided to extend render-interfaces from a boolean to a three-value enum: false | true | 'related'. The related mode renders only interfaces that appear in the active filtered relationships, hiding all others (including unrelated interfaces on seed nodes).

This avoids adding a separate flag entirely — one option, three modes — and sidesteps the naming debate. render-interfaces=related reads naturally as a specialisation of render-interfaces=true.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went through many options, with only- prefixes, ignore- prefixes or include- prefixes.

just extending render-interfaces to be a three-value enum retains backwards compatibility but gives flexibility in the same place on how many interfaces are shown - none, all, or some.

seedNodes was added to VisibilityResult and passed through from the
strategy chain, but no downstream consumer (vm-builder) ever reads it.
…er-interfaces=related

Rather than a separate boolean flag, extend the existing render-interfaces
option to a three-value enum: false | true | 'related'. The 'related' mode
renders only interfaces that appear in the active filtered relationships,
hiding all others. This is a cleaner API surface — one option, three modes —
and avoids the naming ambiguity of the previous flag.
@markscott-ms markscott-ms changed the title feat(calm-widgets): add ignore-connected-interfaces option to block-architecture widget feat(calm-widgets): extend render-interfaces to support related mode Jun 21, 2026
@markscott-ms

Copy link
Copy Markdown
Contributor Author

The description of this PR has been updated following @rocketstack-matt comment #2701 (comment)

@rocketstack-matt rocketstack-matt merged commit 6d7ceff into finos:main Jun 21, 2026
17 checks passed
@markscott-ms markscott-ms deleted the feat/1600-ignore-connected-interfaces branch June 21, 2026 18:02
jpgough-ms pushed a commit to jpgough-ms/architecture-as-code that referenced this pull request Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhance block-architecture to ignore interfaces

3 participants